package top.eggcode.system.modules.log.control;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.eggcode.common.base.PackBaseController;
import top.eggcode.common.model.ResponseResult;
import top.eggcode.system.modules.log.model.ActionLogDetailView;
import top.eggcode.system.modules.log.model.ActionLogQuery;
import top.eggcode.system.modules.log.model.ActionLogView;
import top.eggcode.system.modules.log.service.ActionLogServiceImpl;

/**
 * Title:
 * Description: TODO
 * Date: 2021/5/25 15:13
 *
 * @author JiaQi Ding
 * @version 1.0
 */
@Api(tags = "用户行为日志")
@AllArgsConstructor
@RequestMapping("/api/log/action")
@RestController
public class ActionLogController extends PackBaseController {

    private final ActionLogServiceImpl selfService;

    @GetMapping("{id}")
    public ResponseResult<?> get(@PathVariable String id) {
        return super.pack(selfService.get(id).get(), ActionLogDetailView.class);
    }

    @ApiOperation("列表分页")
    @GetMapping("list/page")
    public ResponseResult<?> listPage(ActionLogQuery query) {

        return super.pack(selfService.page(query), ActionLogView.class);
    }

}
